<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
</head>
<body>
<form id="form">
姓名：<input type="text" name="name" value="小明"><br>
密码：<input type="password" name="password"><br>
<button type="button" id="submit">登录</button>
</form>

<script type="text/javascript" src="${ctxPath}/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="${ctxPath}/js/alert.min.js"></script>
<script type="text/javascript">
$(function(){
	
	$('#submit').on('click',function(){
		$.post('${ctxPath}/login',$('#form').serialize(),function(json){
			if(json.code == 200){
				location.href = '${ctxPath}/index';
			}else{
				$.alert(json.message);
			}
		})
	})
	
	
	
	
})
</script>
</body>
</html>